import request from '../utils/request'

export const getLunbo = () => {
  return request({
    method: 'get',
    url: "/front/index"
  })
}


//优惠券https://api.java.crmeb.net/api/front/coupons?page=1&limit=6
export const getCoupons = () => {
  return request({
    mehod: 'get',
    url: `/front/coupons`

  })
}

//限时秒杀https://api.java.crmeb.net/api/front/seckill/index

export const getseckill = () => {
  return request({
    method: "get",
    url: '/api/front/seckill/index'
  })
}

//拼团惠 https://api.java.crmeb.net/api/front/combination/index

export const getcombination = () => {
  return request({
    method: "get",
    url: '/front/combination/index'
  })
}

//砍价活动 https://api.java.crmeb.net/api/front/bargain/index
export const getbargain = () => {
  return request({
    method: 'get',
    url: '/front/bargain/index'
  })
}
//推荐精品
//https://api.java.crmeb.net/api/front/index/product/1?page=1&limit=10
///front/index/product/1
export const getproduct = id => {
  return request({
    method: 'get',
    url: `/front/index/product/${id}`

  })
}







// 行业资讯头部轮播图
export const zixunlbt = () => {
  return request({
    method: 'get',
    url: '/front/article/banner/list'
  })
}

// 行业资讯中间标签选项
export const zixunbq = () => {
  return request({
    method: 'get',
    url: '/front/article/category/list'
  })
}
// 全部 资讯 
export const zxlist = () => {
  return request({
    method: 'get',
    url: "/front/article/hot/list"

  })
}

// // https://api.java.crmeb.net/api/front/article/hot/list
// // 部分 资讯
export const zixunrm = id => {
  return request({
    method: 'get',
    url: `/front/article/list/${id}`

  })
}
// 行业单条资讯详情
export const zixunxq = id => {
  return request({
    method: 'get',
    url: `/front/article/info/${id}`

  })
}
// 拼团活动轮播图
// https://api.java.crmeb.net/api/front/combination/header

export const combination = () => {
  return request({
    method: 'get',
    url: `/front/combination/header`

  })
}

// 拼团活动内容数据
export const comlist = () => {
  return request({
    method: 'get',
    url: `/front/combination/list `

  })
}
//  https://api.java.crmeb.net/api/front/combination/list?page=1&limit=10
export const getdetail = id => {
  return request({
    method: "get",
    url: "/front/combination/detail/" + id
  })
}

//商品xiangq
export const getxianqin = id => {
  return request({
    methods: 'get',
    url: "/front/product/detail/" + id
  })
}

// 获取收藏产品
// /api/front/collect/user
// export const getcollect= () => {
//   return request({
//     method: "get",
//     url: "/api/front/collect/user"
//   })
// }

// 秒杀活动 今日爆款 活动时间
// https://api.java.crmeb.net/api/front/seckill/header
export const getseckills = () => {
  return request({
    method: "get",
    url: "/api/front/seckill/header"
  })
}
// 秒杀活动商品内容
// https://api.java.crmeb.net/api/front/seckill/index
export const getdatashangp = () => {
  return request({
    method: "get",
    url: "/api/front/seckill/index"
  })
}
// 限时秒杀接口----李正
export const miaoshadata = () => {
  return request({
    method: "get",
    url: "/front/seckll/list/4"
  })
}

// 限时秒杀轮播图接口---李正
export const getmiaoshalbt = () => {
  return request({
    method: "get",
    url: "/front/seckill/lunbo  "
  })
}
// 砍价活动商品数据----李正
export const getkanjia = () => {
  return request({
    method: "get",
    url: "/front/bargain/index"
  })
}

// 登录  账号和密码登录方式

export const login = ({ account, password }) => {
  return request({
    method: "post",
    url: "https://api.java.crmeb.net/api/front/login",
    data: {
      account, password
    }
  })
}

///api/front/login
// https://api.java.crmeb.net/api/front/collect/user?page=1&limit=8
//     获取我的收藏 数据         token值
export const getshoucang = ({ authoriZation }) => {
  return request({
    method: "get",
    url: "https://api.java.crmeb.net/api/front/collect/user?page=1&limit=8",
    headers: {
      "authori-zation": authoriZation
    }
  })
}
// https://api.java.crmeb.net/api/front/coupons?page=1&limit=20&type=2
// 获取优惠卷 各种类型
export const getyhjdata = ({ type }) => {
  return request({
    method: "get",
    url: `https://api.java.crmeb.net/api/front/coupons?page=1&limit=20&type=${type}`
  })
}

// 购物车  获取商品列表
// https://api.java.crmeb.net/api/front/cart/list?page=1&limit=20&isValid=true
export const getshopinglist = ({ authoriZation }) => {
  return request({
    method: "get",
    url: "https://api.java.crmeb.net/api/front/cart/list?page=1&limit=20&isValid=true",
    headers: {
      "authori-zation": authoriZation
    }
  })
}

// 购物车 数量加减
// 需要商品id 和商品数量
// post请求
// https://api.java.crmeb.net/api/front/cart/num
export const cartnum = ({ authoriZation, id, number }) => {

  return request({
    method: "post",
    url: `https://api.java.crmeb.net/api/front/cart/num?id=${id}&number=${number}`,


    headers: {
      "authori-zation": authoriZation
    },


  })
}

// 购物车批量删除
// https://api.java.crmeb.net/api/front/cart/delete
export const cartdelet = ({authoriZation,arr}) => {
  return request({
    method:"post",
    url:`https://api.java.crmeb.net/api/front/cart/delete?ids=${arr}`,
    headers:{
      "authori-zation": authoriZation
    }
  })
}

// https://api.java.crmeb.net/api/front/products?keyword=%E5%A5%B6%E8%8C%B6&page=1&limit=8
export const sousuo=(str)=>{
  return request({
    method:"get",
    url:`https://api.java.crmeb.net/api/front/products?keyword=${str}&page=1&limit=8`
  })
}


// 当前登录用户
// https://api.java.crmeb.net/api/front/user
export const getuser=(authoriZation)=>{
  return request({
    method:"get",
    url:"https://api.java.crmeb.net/api/front/user",
    headers:{
      "authori-zation": authoriZation
    }
  })
}


// 签到积分每天多少
// https://api.java.crmeb.net/api/front/user/sign/config
export const daynum=(authoriZation)=>{
  return request({
    method:"get",
    url:"https://api.java.crmeb.net/api/front/user/sign/config",
    headers:{
      "authori-zation": authoriZation
    }
  })
}
// 获取已签到天数
// https://api.java.crmeb.net/api/front/user/sign/user
export const qiandaoday=(authoriZation)=>{
  return request({
    method:"post",
    url:`https://api.java.crmeb.net/api/front/user/sign/user`,
    headers:{
      "authori-zation": authoriZation
    }
  })
}

// 判断今天是否已签到
// https://api.java.crmeb.net/api/front/user/sign/integral
export const contr=(authoriZation)=>{
  return request({
    method:"get",
    url:`https://api.java.crmeb.net/api/front/user/sign/integral`,
    headers:{
      "authori-zation": authoriZation
    }
  })
}
// 累计签到数据
// https://api.java.crmeb.net/api/front/user/sign/list
export const Cumulative=(authoriZation)=>{
  return request({
    method:"get",
    url:"https://api.java.crmeb.net/api/front/user/sign/list",
    headers:{
      "authori-zation": authoriZation
    }
  })
}
